<template>
    <template v-for="(item, index) in routes" :key="index">

        <el-menu-item v-if="!item.children" :index="item.path">
            <template #title>
                <span>{{ item.meta?.title }}</span>
            </template>
        </el-menu-item>
        <el-sub-menu v-else>
            <template #title>
                <span>{{ item.meta?.title }}</span>
            </template>
            <Menu :routes="item.children"></Menu>
        </el-sub-menu>
    </template>

</template>
<script setup lang="ts">
import {
    defineProps
} from 'vue'
import type { RouteRecordRaw } from 'vue-router';
defineProps<{ routes: RouteRecordRaw[] }>()
import Menu from '@/components/Menu/index.vue'
</script>